package com.funtl.framework.io;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * 读取文件内容
 * @author lusifer
 *
 */
public class FileRead {
	public static String readHtml(String htmlPath) throws FileNotFoundException, IOException {
		StringBuffer html;
		
		File f = new File(htmlPath);
//		System.out.println(f.getAbsolutePath());
//		System.out.println(f.getName());
		FileInputStream ism = new FileInputStream(f);
		InputStreamReader isr = new InputStreamReader(ism);
		BufferedReader bs = new BufferedReader(isr);
		String info = bs.readLine();
		html = new StringBuffer();
		while (info != null) {
			html.append(info);
			info = bs.readLine();
		}
		
		return html.toString();
	}
	
	public static void main(String[] args) throws Exception {
		System.out.println(readHtml("d:/html/test.html"));
	}
}
